﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace Base.Framework
{
    public class UAuthFilterAttribute : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //base.OnActionExecuting(filterContext);;
            //var user =filterContext.RequestContext.HttpContext.Session[CommonController.UserLoginKey] as UserAccount;
            //if (user == null)
            //{
            //    //filterContext.Result = new CommonController().ErrorResult(msg: "登陆信息已超时请重新登录");
            //    return;
            //}
            //if (!user.IsAdmin.HasValue || !user.IsAdmin.Value)
            //{
            //    var actionurl = filterContext.RequestContext.HttpContext.Request.Url.ToString();
            //    //已经配置的权限或者未配置的链接都有访问权限
            //    bool isauth=userolerserver.SvcAdapter.Exists(a => a.RoleAuth.Any(d => d.UserRoleID == user.RoleId) || actionurl.Contains(a.AuthWebPath));
            //    if (!isauth)
            //    {
            //        filterContext.Result = new CommonController().ErrorResult(msg: "您不具有该操作的权限");
            //    }
            //}
            base.OnActionExecuting(filterContext);
        }
    }
}
